home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / trackfld.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  22KB  |  655 lines

  1. /***************************************************************************
  2.  
  3. Konami games memory map (preliminary)
  4.  
  5. Based on drivers from Juno First emulator by Chris Hardy (chrish@kcbbs.gen.nz)
  6.  
  7. Track'n'Field
  8.  
  9. MAIN BOARD:
  10. 0000-17ff RAM
  11. 1800-183f Sprite RAM Pt 1
  12. 1C00-1C3f Sprite RAM Pt 2
  13. 3800-3bff Color RAM
  14. 3000-33ff Video RAM
  15. 6000-ffff ROM
  16. 1200-12ff IO
  17.  
  18. ***************************************************************************/
  19.  
  20. #include "driver.h"
  21. #include "vidhrdw/generic.h"
  22. #include "cpu/m6809/m6809.h"
  23.  
  24.  
  25. void konami1_decode(void);
  26.  
  27.  
  28. extern unsigned char *trackfld_scroll;
  29. extern unsigned char *trackfld_scroll2;
  30. WRITE_HANDLER( trackfld_flipscreen_w );
  31. void trackfld_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  32. void trackfld_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  33. int trackfld_vh_start(void);
  34. void trackfld_vh_stop(void);
  35.  
  36. void hyperspt_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  37.  
  38. WRITE_HANDLER( konami_sh_irqtrigger_w );
  39. READ_HANDLER( trackfld_sh_timer_r );
  40. READ_HANDLER( trackfld_speech_r );
  41. WRITE_HANDLER( trackfld_sound_w );
  42. READ_HANDLER( hyprolyb_speech_r );
  43. WRITE_HANDLER( hyprolyb_ADPCM_data_w );
  44.  
  45. extern struct SN76496interface konami_sn76496_interface;
  46. extern struct DACinterface konami_dac_interface;
  47. extern struct ADPCMinterface hyprolyb_adpcm_interface;
  48.  
  49.  
  50.  
  51. /* handle fake button for speed cheat */
  52. static READ_HANDLER( konami_IN1_r )
  53. {
  54.     int res;
  55.     static int cheat = 0;
  56.     static int bits[] = { 0xee, 0xff, 0xbb, 0xaa };
  57.  
  58.     res = readinputport(1);
  59.  
  60.     if ((res & 0x80) == 0)
  61.     {
  62.         res |= 0x55;
  63.         res &= bits[cheat];
  64.         cheat = (++cheat)%4;
  65.     }
  66.     return res;
  67. }
  68.  
  69.  
  70.  
  71. /*
  72.  Track'n'Field has 1k of battery backed RAM which can be erased by setting a dipswitch
  73. */
  74. static unsigned char *nvram;
  75. static size_t nvram_size;
  76. static int we_flipped_the_switch;
  77.  
  78. static void nvram_handler(void *file,int read_or_write)
  79. {
  80.     if (read_or_write)
  81.     {
  82.         osd_fwrite(file,nvram,nvram_size);
  83.  
  84.         if (we_flipped_the_switch)
  85.         {
  86.             struct InputPort *in;
  87.  
  88.  
  89.             /* find the dip switch which resets the high score table, and set it */
  90.             /* back to off. */
  91.             in = Machine->input_ports;
  92.  
  93.             while (in->type != IPT_END)
  94.             {
  95.                 if (in->name != NULL && in->name != IP_NAME_DEFAULT &&
  96.                         strcmp(in->name,"World Records") == 0)
  97.                 {
  98.                     if (in->default_value == 0)
  99.                         in->default_value = in->mask;
  100.                     break;
  101.                 }
  102.  
  103.                 in++;
  104.             }
  105.  
  106.             we_flipped_the_switch = 0;
  107.         }
  108.     }
  109.     else
  110.     {
  111.         if (file)
  112.         {
  113.             osd_fread(file,nvram,nvram_size);
  114.             we_flipped_the_switch = 0;
  115.         }
  116.         else
  117.         {
  118.             struct InputPort *in;
  119.  
  120.  
  121.             /* find the dip switch which resets the high score table, and set it on */
  122.             in = Machine->input_ports;
  123.  
  124.             while (in->type != IPT_END)
  125.             {
  126.                 if (in->name != NULL && in->name != IP_NAME_DEFAULT &&
  127.                         strcmp(in->name,"World Records") == 0)
  128.                 {
  129.                     if (in->default_value == in->mask)
  130.                     {
  131.                         in->default_value = 0;
  132.                         we_flipped_the_switch = 1;
  133.                     }
  134.                     break;
  135.                 }
  136.  
  137.                 in++;
  138.             }
  139.         }
  140.     }
  141. }
  142.  
  143.  
  144.  
  145. static struct MemoryReadAddress readmem[] =
  146. {
  147.     { 0x1800, 0x185f, MRA_RAM },
  148.     { 0x1c00, 0x1c5f, MRA_RAM },
  149.     { 0x1200, 0x1200, input_port_4_r }, /* DIP 2 */
  150.     { 0x1280, 0x1280, input_port_0_r }, /* IO Coin */
  151. //    { 0x1281, 0x1281, input_port_1_r }, /* P1 IO */
  152.     { 0x1281, 0x1281, konami_IN1_r },    /* P1 IO and handle fake button for cheating */
  153.     { 0x1282, 0x1282, input_port_2_r }, /* P2 IO */
  154.     { 0x1283, 0x1283, input_port_3_r }, /* DIP 1 */
  155.     { 0x2800, 0x3fff, MRA_RAM },
  156.     { 0x6000, 0xffff, MRA_ROM },
  157.     { -1 }  /* end of table */
  158. };
  159.  
  160. static struct MemoryWriteAddress writemem[] =
  161. {
  162.     { 0x1000, 0x1000, watchdog_reset_w },
  163.     { 0x1080, 0x1080, trackfld_flipscreen_w },
  164.     { 0x1081, 0x1081, konami_sh_irqtrigger_w },  /* cause interrupt on audio CPU */
  165.     { 0x1083, 0x1083, MWA_NOP },  /* Coin counter 1 */
  166.     { 0x1084, 0x1084, MWA_NOP },  /* Coin counter 2 */
  167.     { 0x1087, 0x1087, interrupt_enable_w },
  168.     { 0x1100, 0x1100, soundlatch_w },
  169.     { 0x2800, 0x2fff, MWA_RAM },
  170.     { 0x1800, 0x183f, MWA_RAM, &spriteram_2 },
  171.     { 0x1840, 0x185f, MWA_RAM, &trackfld_scroll },  /* Scroll amount */
  172.     { 0x1C00, 0x1c3f, MWA_RAM, &spriteram, &spriteram_size },
  173.     { 0x1C40, 0x1C5f, MWA_RAM, &trackfld_scroll2 },  /* Scroll amount */
  174.     { 0x2800, 0x2bff, MWA_RAM },
  175.     { 0x2c00, 0x2fff, MWA_RAM, &nvram, &nvram_size },
  176.     { 0x3000, 0x37ff, videoram_w, &videoram, &videoram_size },
  177.     { 0x3800, 0x3fff, colorram_w, &colorram },
  178.     { 0x6000, 0xffff, MWA_ROM },
  179.     { -1 }  /* end of table */
  180. };
  181.  
  182. static struct MemoryReadAddress sound_readmem[] =
  183. {
  184.     { 0x0000, 0x3fff, MRA_ROM },
  185.     { 0x4000, 0x43ff, MRA_RAM },
  186.     { 0x6000, 0x6000, soundlatch_r },
  187.     { 0x8000, 0x8000, trackfld_sh_timer_r },
  188.     { 0xe002, 0xe002, trackfld_speech_r },
  189.     { -1 }    /* end of table */
  190. };
  191.  
  192. static struct MemoryWriteAddress sound_writemem[] =
  193. {
  194.     { 0x0000, 0x3fff, MWA_ROM },
  195.     { 0x4000, 0x43ff, MWA_RAM },
  196.     { 0xa000, 0xa000, SN76496_0_w },    /* Loads the snd command into the snd latch */
  197.     { 0xc000, 0xc000, MWA_NOP },        /* This address triggers the SN chip to read the data port. */
  198.     { 0xe000, 0xe000, DAC_0_data_w },
  199. /* There are lots more addresses which are used for setting a two bit volume
  200.     controls for speech and music
  201.  
  202.     Currently these are un-supported by Mame
  203. */
  204.     { 0xe001, 0xe001, MWA_NOP }, /* watch dog ? */
  205.     { 0xe004, 0xe004, VLM5030_data_w },
  206.     { 0xe000, 0xefff, trackfld_sound_w, }, /* e003 speech control */
  207.     { -1 }    /* end of table */
  208. };
  209.  
  210. static struct MemoryReadAddress hyprolyb_sound_readmem[] =
  211. {
  212.     { 0x0000, 0x3fff, MRA_ROM },
  213.     { 0x4000, 0x43ff, MRA_RAM },
  214.     { 0x6000, 0x6000, soundlatch_r },
  215.     { 0x8000, 0x8000, trackfld_sh_timer_r },
  216.     { 0xe002, 0xe002, hyprolyb_speech_r },
  217.     { -1 }    /* end of table */
  218. };
  219.  
  220. static struct MemoryWriteAddress hyprolyb_sound_writemem[] =
  221. {
  222.     { 0x0000, 0x3fff, MWA_ROM },
  223.     { 0x4000, 0x43ff, MWA_RAM },
  224.     { 0xa000, 0xa000, SN76496_0_w },    /* Loads the snd command into the snd latch */
  225.     { 0xc000, 0xc000, MWA_NOP },        /* This address triggers the SN chip to read the data port. */
  226.     { 0xe000, 0xe000, DAC_0_data_w },
  227. /* There are lots more addresses which are used for setting a two bit volume
  228.     controls for speech and music
  229.  
  230.     Currently these are un-supported by Mame
  231. */
  232.     { 0xe001, 0xe001, MWA_NOP }, /* watch dog ? */
  233.     { 0xe004, 0xe004, hyprolyb_ADPCM_data_w },
  234.     { 0xe000, 0xefff, MWA_NOP },
  235.     { -1 }    /* end of table */
  236. };
  237.  
  238.  
  239.  
  240. INPUT_PORTS_START( trackfld )
  241.     PORT_START      /* IN0 */
  242.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  243.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  244.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  245.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  246.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  247.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  248.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  249.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  250.  
  251.     PORT_START      /* IN1 */
  252.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
  253.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  254.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  255.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 )
  256.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  257.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  258.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  259. //    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  260.     /* Fake button to press buttons 1 and 3 impossibly fast. Handle via konami_IN1_r */
  261.     PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_CHEAT | IPF_PLAYER1, "Run Like Hell Cheat", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  262.  
  263.     PORT_START      /* IN2 */
  264.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 /*| IPF_COCKTAIL*/ )
  265.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 /*| IPF_COCKTAIL*/ )
  266.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 /*| IPF_COCKTAIL*/ )
  267.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 )
  268.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 /*| IPF_COCKTAIL*/ )
  269.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 /*| IPF_COCKTAIL*/ )
  270.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 /*| IPF_COCKTAIL*/ )
  271.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  272.  
  273.     PORT_START      /* DSW0 */
  274.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  275.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  276.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  277.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  278.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  279.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  280.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  281.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  282.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  283.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  284.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  285.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  286.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  287.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  288.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  289.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  290.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  291.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  292.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  293.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  294.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  295.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  296.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  297.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  298.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  299.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  300.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  301.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  302.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  303.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  304.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  305.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  306.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  307.     PORT_DIPSETTING(    0x00, "Disabled" )
  308. /* 0x00 disables Coin 2. It still accepts coins and makes the sound, but
  309.    it doesn't give you any credit */
  310.  
  311.     PORT_START      /* DSW1 */
  312.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  313.     PORT_DIPSETTING(    0x01, "1" )
  314.     PORT_DIPSETTING(    0x00, "2" )
  315.     PORT_DIPNAME( 0x02, 0x00, "After Last Event" )
  316.     PORT_DIPSETTING(    0x02, "Game Over" )
  317.     PORT_DIPSETTING(    0x00, "Game Continues" )
  318.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  319.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  320.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ))
  321.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Bonus_Life ) )
  322.     PORT_DIPSETTING(    0x08, "None" )
  323.     PORT_DIPSETTING(    0x00, "100000" )
  324.     PORT_DIPNAME( 0x10, 0x10, "World Records" )
  325.     PORT_DIPSETTING(    0x10, "Don't Erase" )
  326.     PORT_DIPSETTING(    0x00, "Erase on Reset" )
  327.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  328.     PORT_DIPSETTING(    0x60, "Easy" )
  329.     PORT_DIPSETTING(    0x40, "Normal" )
  330.     PORT_DIPSETTING(    0x20, "Hard" )
  331.     PORT_DIPSETTING(    0x00, "Difficult" )
  332.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  333.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  334.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  335. INPUT_PORTS_END
  336.  
  337.  
  338.  
  339. static struct GfxLayout charlayout =
  340. {
  341.     8,8,    /* 8*8 characters */
  342.     768,    /* 768 characters */
  343.     4,    /* 4 bits per pixel */
  344.     { 0, 1, 2, 3 },    /* the four bitplanes are packed in one nibble */
  345.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
  346.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
  347.     32*8    /* every char takes 8 consecutive bytes */
  348. };
  349.  
  350. static struct GfxLayout spritelayout =
  351. {
  352.     16,16,    /* 16*16 sprites */
  353.     256,    /* 256 sprites */
  354.     4,    /* 4 bits per pixel */
  355.     { 256*64*8+4, 256*64*8+0, 4, 0 },
  356.     { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
  357.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
  358.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  359.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  360.     64*8    /* every sprite takes 64 consecutive bytes */
  361. };
  362.  
  363. static struct GfxDecodeInfo gfxdecodeinfo[] =
  364. {
  365.     { REGION_GFX1, 0, &charlayout,       0, 16 },
  366.     { REGION_GFX2, 0, &spritelayout, 16*16, 16 },
  367.     { -1 } /* end of array */
  368. };
  369.  
  370.  
  371.  
  372. /* filename for trackn field sample files */
  373. static const char *trackfld_sample_names[] =
  374. {
  375.     "*trackfld",
  376.     "00.wav","01.wav","02.wav","03.wav","04.wav","05.wav","06.wav","07.wav",
  377.     "08.wav","09.wav","0a.wav","0b.wav","0c.wav","0d.wav","0e.wav","0f.wav",
  378.     "10.wav","11.wav","12.wav","13.wav","14.wav","15.wav","16.wav","17.wav",
  379.     "18.wav","19.wav","1a.wav","1b.wav","1c.wav","1d.wav","1e.wav","1f.wav",
  380.     "20.wav","21.wav","22.wav","23.wav","24.wav","25.wav","26.wav","27.wav",
  381.     "28.wav","29.wav","2a.wav","2b.wav","2c.wav","2d.wav","2e.wav","2f.wav",
  382.     "30.wav","31.wav","32.wav","33.wav","34.wav","35.wav","36.wav","37.wav",
  383.     "38.wav","39.wav","3a.wav","3b.wav","3c.wav","3d.wav",
  384.     0
  385. };
  386.  
  387. struct VLM5030interface trackfld_vlm5030_interface =
  388. {
  389.     3580000,    /* master clock  */
  390.     255,        /* volume        */
  391.     REGION_SOUND1,    /* memory region  */
  392.     0,         /* memory size    */
  393.     0,         /* VCU            */
  394.     trackfld_sample_names
  395. };
  396.  
  397.  
  398.  
  399. static struct MachineDriver machine_driver_tracklfd =
  400. {
  401.     /* basic machine hardware */
  402.     {
  403.         {
  404.             CPU_M6809,
  405.             2048000,        /* 1.400 Mhz ??? */
  406.             readmem,writemem,0,0,
  407.             interrupt,1
  408.         },
  409.         {
  410.             CPU_Z80 | CPU_AUDIO_CPU,
  411.             14318180/4,    /* Z80 Clock is derived from a 14.31818 Mhz crystal */
  412.             sound_readmem,sound_writemem,0,0,
  413.             ignore_interrupt,1    /* interrupts are triggered by the main CPU */
  414.         }
  415.     },
  416.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  417.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  418.     0,
  419.  
  420.     /* video hardware */
  421.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  422.     gfxdecodeinfo,
  423.     32,16*16+16*16,
  424.     trackfld_vh_convert_color_prom,
  425.  
  426.     VIDEO_TYPE_RASTER,
  427.     0,
  428.     trackfld_vh_start,
  429.     trackfld_vh_stop,
  430.     trackfld_vh_screenrefresh,
  431.  
  432.     /* sound hardware */
  433.     0,0,0,0,
  434.     {
  435.         {
  436.             SOUND_DAC,
  437.             &konami_dac_interface
  438.         },
  439.         {
  440.             SOUND_SN76496,
  441.             &konami_sn76496_interface
  442.         },
  443.         {
  444.             SOUND_VLM5030,
  445.             &trackfld_vlm5030_interface
  446.         }
  447.     },
  448.  
  449.     nvram_handler
  450. };
  451.  
  452. /* same as the original, but uses ADPCM instead of VLM5030 */
  453. /* also different memory handlers do handle that */
  454. static struct MachineDriver machine_driver_hyprolyb =
  455. {
  456.     /* basic machine hardware */
  457.     {
  458.         {
  459.             CPU_M6809,
  460.             2048000,        /* 1.400 Mhz ??? */
  461.             readmem,writemem,0,0,
  462.             interrupt,1
  463.         },
  464.         {
  465.             CPU_Z80 | CPU_AUDIO_CPU,
  466.             14318180/4,    /* Z80 Clock is derived from a 14.31818 Mhz crystal */
  467.             hyprolyb_sound_readmem,hyprolyb_sound_writemem,0,0,
  468.             ignore_interrupt,0    /* interrupts are triggered by the main CPU */
  469.         }
  470.     },
  471.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  472.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  473.     0,
  474.  
  475.     /* video hardware */
  476.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  477.     gfxdecodeinfo,
  478.     32,16*16+16*16,
  479.     trackfld_vh_convert_color_prom,
  480.  
  481.     VIDEO_TYPE_RASTER,
  482.     0,
  483.     trackfld_vh_start,
  484.     trackfld_vh_stop,
  485.     trackfld_vh_screenrefresh,
  486.  
  487.     /* sound hardware */
  488.     0,0,0,0,
  489.     {
  490.         {
  491.             SOUND_DAC,
  492.             &konami_dac_interface
  493.         },
  494.         {
  495.             SOUND_SN76496,
  496.             &konami_sn76496_interface
  497.         },
  498.         {
  499.             SOUND_ADPCM,
  500.             &hyprolyb_adpcm_interface
  501.         }
  502.     },
  503.  
  504.     nvram_handler
  505. };
  506.  
  507.  
  508.  
  509. /***************************************************************************
  510.  
  511.   Game driver(s)
  512.  
  513. ***************************************************************************/
  514.  
  515. ROM_START( trackfld )
  516.     ROM_REGION( 2*0x10000, REGION_CPU1 )     /* 64k for code + 64k for decrypted opcodes */
  517.     ROM_LOAD( "a01_e01.bin",  0x6000, 0x2000, 0x2882f6d4 )
  518.     ROM_LOAD( "a02_e02.bin",  0x8000, 0x2000, 0x1743b5ee )
  519.     ROM_LOAD( "a03_k03.bin",  0xA000, 0x2000, 0x6c0d1ee9 )
  520.     ROM_LOAD( "a04_e04.bin",  0xC000, 0x2000, 0x21d6c448 )
  521.     ROM_LOAD( "a05_e05.bin",  0xE000, 0x2000, 0xf08c7b7e )
  522.  
  523.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  524.     ROM_LOAD( "c2_d13.bin",   0x0000, 0x2000, 0x95bf79b6 )
  525.  
  526.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  527.     ROM_LOAD( "h16_e12.bin",  0x0000, 0x2000, 0x50075768 )
  528.     ROM_LOAD( "h15_e11.bin",  0x2000, 0x2000, 0xdda9e29f )
  529.     ROM_LOAD( "h14_e10.bin",  0x4000, 0x2000, 0xc2166a5c )
  530.  
  531.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  532.     ROM_LOAD( "c11_d06.bin",  0x0000, 0x2000, 0x82e2185a )
  533.     ROM_LOAD( "c12_d07.bin",  0x2000, 0x2000, 0x800ff1f1 )
  534.     ROM_LOAD( "c13_d08.bin",  0x4000, 0x2000, 0xd9faf183 )
  535.     ROM_LOAD( "c14_d09.bin",  0x6000, 0x2000, 0x5886c802 )
  536.  
  537.     ROM_REGION( 0x0220, REGION_PROMS )
  538.     ROM_LOAD( "tfprom.1",     0x0000, 0x0020, 0xd55f30b5 ) /* palette */
  539.     ROM_LOAD( "tfprom.3",     0x0020, 0x0100, 0xd2ba4d32 ) /* sprite lookup table */
  540.     ROM_LOAD( "tfprom.2",     0x0120, 0x0100, 0x053e5861 ) /* char lookup table */
  541.  
  542.     ROM_REGION( 0x10000, REGION_SOUND1 )    /* 64k for speech rom */
  543.     ROM_LOAD( "c9_d15.bin",   0x0000, 0x2000, 0xf546a56b )
  544. ROM_END
  545.  
  546. ROM_START( trackflc )
  547.     ROM_REGION( 2*0x10000, REGION_CPU1 )     /* 64k for code + 64k for decrypted opcodes */
  548.     ROM_LOAD( "f01.1a",       0x6000, 0x2000, 0x4e32b360 )
  549.     ROM_LOAD( "f02.2a",       0x8000, 0x2000, 0x4e7ebf07 )
  550.     ROM_LOAD( "l03.3a",       0xA000, 0x2000, 0xfef4c0ea )
  551.     ROM_LOAD( "f04.4a",       0xC000, 0x2000, 0x73940f2d )
  552.     ROM_LOAD( "f05.5a",       0xE000, 0x2000, 0x363fd761 )
  553.  
  554.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  555.     ROM_LOAD( "c2_d13.bin",   0x0000, 0x2000, 0x95bf79b6 )
  556.  
  557.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  558.     ROM_LOAD( "h16_e12.bin",  0x0000, 0x2000, 0x50075768 )
  559.     ROM_LOAD( "h15_e11.bin",  0x2000, 0x2000, 0xdda9e29f )
  560.     ROM_LOAD( "h14_e10.bin",  0x4000, 0x2000, 0xc2166a5c )
  561.  
  562.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  563.     ROM_LOAD( "c11_d06.bin",  0x0000, 0x2000, 0x82e2185a )
  564.     ROM_LOAD( "c12_d07.bin",  0x2000, 0x2000, 0x800ff1f1 )
  565.     ROM_LOAD( "c13_d08.bin",  0x4000, 0x2000, 0xd9faf183 )
  566.     ROM_LOAD( "c14_d09.bin",  0x6000, 0x2000, 0x5886c802 )
  567.  
  568.     ROM_REGION( 0x0220, REGION_PROMS )
  569.     ROM_LOAD( "tfprom.1",     0x0000, 0x0020, 0xd55f30b5 ) /* palette */
  570.     ROM_LOAD( "tfprom.3",     0x0020, 0x0100, 0xd2ba4d32 ) /* sprite lookup table */
  571.     ROM_LOAD( "tfprom.2",     0x0120, 0x0100, 0x053e5861 ) /* char lookup table */
  572.  
  573.     ROM_REGION( 0x10000, REGION_SOUND1 )    /* 64k for speech rom */
  574.     ROM_LOAD( "c9_d15.bin",   0x0000, 0x2000, 0xf546a56b )
  575. ROM_END
  576.  
  577. ROM_START( hyprolym )
  578.     ROM_REGION( 2*0x10000, REGION_CPU1 )     /* 64k for code + 64k for decrypted opcodes */
  579.     ROM_LOAD( "hyprolym.a01", 0x6000, 0x2000, 0x82257fb7 )
  580.     ROM_LOAD( "hyprolym.a02", 0x8000, 0x2000, 0x15b83099 )
  581.     ROM_LOAD( "hyprolym.a03", 0xA000, 0x2000, 0xe54cc960 )
  582.     ROM_LOAD( "hyprolym.a04", 0xC000, 0x2000, 0xd099b1e8 )
  583.     ROM_LOAD( "hyprolym.a05", 0xE000, 0x2000, 0x974ff815 )
  584.  
  585.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  586.     ROM_LOAD( "c2_d13.bin",   0x0000, 0x2000, 0x95bf79b6 )
  587.  
  588.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  589.     ROM_LOAD( "hyprolym.h16", 0x0000, 0x2000, 0x768bb63d )
  590.     ROM_LOAD( "hyprolym.h15", 0x2000, 0x2000, 0x3af0e2a8 )
  591.     ROM_LOAD( "h14_e10.bin",  0x4000, 0x2000, 0xc2166a5c )
  592.  
  593.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  594.     ROM_LOAD( "c11_d06.bin",  0x0000, 0x2000, 0x82e2185a )
  595.     ROM_LOAD( "c12_d07.bin",  0x2000, 0x2000, 0x800ff1f1 )
  596.     ROM_LOAD( "c13_d08.bin",  0x4000, 0x2000, 0xd9faf183 )
  597.     ROM_LOAD( "c14_d09.bin",  0x6000, 0x2000, 0x5886c802 )
  598.  
  599.     ROM_REGION( 0x0220, REGION_PROMS )
  600.     ROM_LOAD( "tfprom.1",     0x0000, 0x0020, 0xd55f30b5 ) /* palette */
  601.     ROM_LOAD( "tfprom.3",     0x0020, 0x0100, 0xd2ba4d32 ) /* sprite lookup table */
  602.     ROM_LOAD( "tfprom.2",     0x0120, 0x0100, 0x053e5861 ) /* char lookup table */
  603.  
  604.     ROM_REGION( 0x10000, REGION_SOUND1 )    /* 64k for speech rom */
  605.     ROM_LOAD( "c9_d15.bin",   0x0000, 0x2000, 0xf546a56b )
  606. ROM_END
  607.  
  608. ROM_START( hyprolyb )
  609.     ROM_REGION( 2*0x10000, REGION_CPU1 )     /* 64k for code + 64k for decrypted opcodes */
  610.     ROM_LOAD( "a1.1",         0x6000, 0x2000, 0x9aee2d5a )
  611.     ROM_LOAD( "hyprolym.a02", 0x8000, 0x2000, 0x15b83099 )
  612.     ROM_LOAD( "a3.3",         0xA000, 0x2000, 0x2d6fc308 )
  613.     ROM_LOAD( "hyprolym.a04", 0xC000, 0x2000, 0xd099b1e8 )
  614.     ROM_LOAD( "hyprolym.a05", 0xE000, 0x2000, 0x974ff815 )
  615.  
  616.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  617.     ROM_LOAD( "c2_d13.bin",   0x0000, 0x2000, 0x95bf79b6 )
  618.  
  619.     ROM_REGION( 0x10000, REGION_CPU3 )    /*  64k for the 6802 which plays ADPCM samples */
  620.     /* this bootleg uses a 6802 to "emulate" the VLM5030 speech chip */
  621.     /* I didn't bother to emulate the 6802, I just play the samples. */
  622.     ROM_LOAD( "2764.1",       0x8000, 0x2000, 0xa4cddeb8 )
  623.     ROM_LOAD( "2764.2",       0xa000, 0x2000, 0xe9919365 )
  624.     ROM_LOAD( "2764.3",       0xc000, 0x2000, 0xc3ec42e1 )
  625.     ROM_LOAD( "2764.4",       0xe000, 0x2000, 0x76998389 )
  626.  
  627.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  628.     ROM_LOAD( "hyprolym.h16", 0x0000, 0x2000, 0x768bb63d )
  629.     ROM_LOAD( "hyprolym.h15", 0x2000, 0x2000, 0x3af0e2a8 )
  630.     ROM_LOAD( "h14_e10.bin",  0x4000, 0x2000, 0xc2166a5c )
  631.  
  632.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  633.     ROM_LOAD( "c11_d06.bin",  0x0000, 0x2000, 0x82e2185a )
  634.     ROM_LOAD( "c12_d07.bin",  0x2000, 0x2000, 0x800ff1f1 )
  635.     ROM_LOAD( "c13_d08.bin",  0x4000, 0x2000, 0xd9faf183 )
  636.     ROM_LOAD( "c14_d09.bin",  0x6000, 0x2000, 0x5886c802 )
  637.  
  638.     ROM_REGION( 0x0220, REGION_PROMS )
  639.     ROM_LOAD( "tfprom.1",     0x0000, 0x0020, 0xd55f30b5 ) /* palette */
  640.     ROM_LOAD( "tfprom.3",     0x0020, 0x0100, 0xd2ba4d32 ) /* sprite lookup table */
  641.     ROM_LOAD( "tfprom.2",     0x0120, 0x0100, 0x053e5861 ) /* char lookup table */
  642. ROM_END
  643.  
  644.  
  645. static void init_trackfld(void)
  646. {
  647.     konami1_decode();
  648. }
  649.  
  650.  
  651. GAME( 1983, trackfld, 0,        tracklfd, trackfld, trackfld, ROT0, "Konami", "Track & Field" )
  652. GAME( 1983, trackflc, trackfld, tracklfd, trackfld, trackfld, ROT0, "Konami (Centuri license)", "Track & Field (Centuri)" )
  653. GAME( 1983, hyprolym, trackfld, tracklfd, trackfld, trackfld, ROT0, "Konami", "Hyper Olympic" )
  654. GAME( 1983, hyprolyb, trackfld, hyprolyb, trackfld, trackfld, ROT0, "bootleg", "Hyper Olympic (bootleg)" )
  655.